package com.link2room.blaster.util;

import com.link2room.blaster.dto.innerUse.InmailBaseDto;
import com.link2room.common.mns.MNSUtil;
import com.link2room.common.util.JacksonUtil;
import com.link2room.common.util.L2RAssert;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static com.link2room.blaster.constant.BlasterMnsConstant.QUEUE_IN_MAIL_SEND;


/**
 * Created by LN on 2017/6/28.14:12
 */
@Component("inMailMessageUtil")
public class InMailMessageUtil {
    @Resource
    private MNSUtil mnsUtill;

    public void sendInMail(InmailBaseDto baseDto){
        L2RAssert.stringBlank(baseDto.getLhotelGroupCode(),"[lhotelGroupCode] is null.");
        L2RAssert.stringBlank(baseDto.getLhotelCode(),"[lhotelCode] is null.");
        L2RAssert.stringBlank(baseDto.getMessage(),"[message] is null.");
        L2RAssert.stringBlank(baseDto.getTitle(),"[title] is null.");
        L2RAssert.stringBlank(baseDto.getType(),"[type] is null.");
        mnsUtill.putMessageToQueue(QUEUE_IN_MAIL_SEND, JacksonUtil.beanToJson(baseDto));
    }
}
